import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
// import '../theme/index.css'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
import echarts from "echarts"
import 'echarts/map/js/china'
import '@/styles/index.scss' // global css
import utils from "./utils/index"
import App from './App'
import store from './store'
import router from './router'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
import formCreate from '@form-create/iview'
import html2canvas from 'html2canvas'
// 获取生成器
import '@/icons' // icon
import '@/permission' // permission control
// 自定义的公用组件
// import srcCom from "zdznkj-component"
// import "zdznkj-component/lib/zdznkj-component.css"
import AMap from "vue-amap"
Vue.use(AMap)
// Vue.use(srcCom)

AMap.initAMapApiLoader({
  // 高德key
  key: '923b1266d4d2b59f12ecb86c75784014',
  // 插件集合 （插件按需引入）
  plugin: ['AMap.Geolocation', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType']
});
Vue.prototype.$echarts = echarts
Vue.prototype.html2canvas = html2canvas
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */
// import { mockXHR } from '../mock'
// if (process.env.NODE_ENV === 'production') {
//   mockXHR()
// }

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
Vue.use(iView)
Vue.use(formCreate)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

Vue.filter("timeFlt", function(value) {
  if (!value) return ""
  return utils.parseTime(value, "{y}-{m}-{d} {h}:{i}:{s}")
})
Vue.filter("diagonsticStatusFlt", function(value) {
  if (!value) return ""
  const tem = ["诊断中", "诊断完成", "诊断失败"]
  return tem[value]
})
